/*
 * @Author: lihaonan
 * @Date: 2024-06-18 08:51:43
 * @LastEditors: 毕晨曦
 * @LastEditTime: 2024-12-10 21:30:49
 * @Description: 请填写简介
 */
/*
 * @Author: 毕晨曦
 * @Date: 2023-11-15 13:17:37
 * @LastEditors: lihaonan
 * @LastEditTime: 2024-06-18 08:52:15
 * @FilePath: /wucha_wechat_miniprog/src/api/appNumber.ts
 * @Description: app api
 */
const BASE_URL_EXCEPTION = "/app/member-info";
import http from "@/utils/http";

/**
 * @description: 获取当前用户信息
 * @return {*}
 */
export function getUserInfo(
  phone: string,
  code: string
): Promise<{ data: any; code: number }> {
  return http.get(`${BASE_URL_EXCEPTION}/tk`, {
    code,
    phone,
  });
}

/**
 * @description: 模糊查询会员信息
 * @param {object} params
 */
export function getNumberList(params: { code: string }) {
  return http.get(`${BASE_URL_EXCEPTION}/app`, { searchVal: params.code });
}

/**
 * @description: 获取志愿者、教练列表
 * @param {object} params
 */
export function getRedCoachList(params: {
  pageSize: number;
  lastId?: number;
  type: "MATCHMAKER" | "COACH";
}) {
  return http.get(`${BASE_URL_EXCEPTION}/turn`, params);
}

/**
 * @description: 查询会员信息
 * @param {object} params
 */
export function getNumberData(id: string | number) {
  return http.get(`${BASE_URL_EXCEPTION}/${id}`);
}

/**
 * @description: 更新会员信息
 */
export function updateNumber(params: any) {
  return http.put(`${BASE_URL_EXCEPTION}`, params);
}

/**
 * @description: 查询用户分组列表
 * @param {object} params
 */
export function getNumberGroup(param: { pageSize: number; pageNum: number }) {
  return http.get(`${BASE_URL_EXCEPTION}-group`, param);
}

/**
 * @description: 新增关注
 * @return {object} param
 */
export function focusRel(param: {
  comment: string;
  focusUserId: string | number;
  groupId: string;
}) {
  return http.post(`${BASE_URL_EXCEPTION}-focus-rel`, param);
}

/**
 * @description: 更新关注
 * @return {object} param
 */
export function updateFocusRel(param: {
  comment: string;
  groupId: string;
  id: number | string;
}) {
  return http.put(`${BASE_URL_EXCEPTION}-focus-rel`, param);
}

/**
 * @description: 获取关注用户列表
 */
export function getFocusList() {
  return http.get(`${BASE_URL_EXCEPTION}-focus-rel/list`);
}

/**
 * @description: 取消好友关注
 * @param {string} id
 */
export function removeFocus(id: string | number) {
  return http.delete(`${BASE_URL_EXCEPTION}-focus-rel/app/${id}`);
}

/**
 * @description: 雷达匹配
 * @param {string} four
 */
export function matchMember(four: string) {
  return http.get(`${BASE_URL_EXCEPTION}/match-radar?four=${four}`);
}
